#pragma once
#include <functional>
#include <memory>

using namespace std;

namespace tmms
{
    namespace base
    {

        class Task;
        using TaskPtr = shared_ptr<Task>;
        using TaskCallBack = function<void(const TaskPtr&)>;
        class Task
        {
            public:
                Task(const TaskCallBack &db, int64_t interval);
                Task(const TaskCallBack &&db, int64_t interval);
                void Run();
                void Restart();
            private:
              int64_t interval{0};
              int64_t when{0};
              TaskCallBack cb;
        };  

    }
}